﻿@extends("admin.base.base")
@section("title")
	<title>研学心得</title>
	<link href="{{asset('css/admin/css/picture.css')}}" rel="stylesheet" type="text/css" />
	<link href="{{ asset('css/admin/css/paginate.css') }}" rel="stylesheet">
@endsection
@section("content")
	<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 资讯管理 <span class="c-gray en">&gt;</span> 研学心得 <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>
	<div class="page-container">

		<div class="cl pd-5 bg-1 bk-gray mt-20">  <span class="r">共有数据：<strong>{{$item->total()}}</strong> 条</span> </div>
		<div class="mt-20">
			<form>
				<table class="table table-border table-bordered table-bg table-hover table-sort">
					<thead>
					<tr class="text-c">
						<th width="20"><input name="" type="checkbox" value=""></th>
						<th width="20">ID</th>
						<th width="50">封面图</th>
						<th width="100">标题</th>
						<th width="150">描述</th>
						<th width="60">更新时间</th>
                        <th width="40">点赞数</th>
                        <th width="40">评论数</th>
                        <th width="40">浏览数</th>
						<th width="60">操作</th>
					</tr>
					</thead>
					<tbody>
                    @foreach($item as $items)
						<tr class="text-c">
							<td><input name="" type="checkbox" value=""></td>
							<td>{{$items->id}}</td>
							<td><a><img width="70" height="50" class="picture-thumb" src="{{$items->img}}"></a></td>
							<td>{{$items->title}}</td>
							<td>{{$items->description}}</td>
							<td>{{$items->created_at}}</td>
                            <td>{{$items->zan}}</td>
                            <td>{{$items->id}}</td>
                            <td>{{$items->browse}}</td>
							<td class="td-manage">
								{{csrf_field()}}
								{{method_field('DELETE')}}
								<a style="text-decoration:none" class="ml-5" onClick="travels_show('查看','{{url('admin/travels/'.$items->id)}}','{{$items->id}}')" href="javascript:;" title="查看"><i class="Hui-iconfont">&#xe665;</i></a>
								<a style="text-decoration:none" class="ml-5" onClick="travels_del(this,'{{$items->id}}')" href="javascript:;" title="删除"><i class="Hui-iconfont">&#xe6e2;</i></a>
							</td>
						</tr>
                    @endforeach
					</tbody>
				</table>
				<div class="pages">
					{{ $item->links() }}
				</div>
			</form>
		</div>
	</div>
@endsection
@section("js")
	<!--请在下方写此页面业务相关的脚本-->
	<script type="text/javascript" src="{{asset('lib/My97DatePicker/4.8/WdatePicker.js')}}"></script>
	<script type="text/javascript" src="{{asset('lib/datatables/1.10.0/jquery.dataTables.min.js')}}"></script>
	<script type="text/javascript" src="{{asset('lib/laypage/1.2/laypage.js')}}"></script>
	<script type="text/javascript">
        $('.table-sort').dataTable({
            "aaSorting": [[ 1, "desc" ]],//默认第几个排序
            "bStateSave": true,//状态保存
            "aoColumnDefs": [
                //{"bVisible": false, "aTargets": [ 3 ]} //控制列的隐藏显示
                {"orderable":false,"aTargets":[0,6]}// 制定列不参与排序
            ]
        });

        /*游记-查看*/
        function travels_show(title,url,id){
            var index = layer.open({
                type: 2,
                title: title,
                content: url
            });
            layer.full(index);
        }

        /*游记-删除*/
        function travels_del(obj,id){
            layer.confirm('确认要删除吗？',function(index){
                $.ajax({
                    type: 'POST',
                    method:'DELETE',
                    url: '{{url('admin/travels')}}'+'/'+id,
                    data:{'_token':'{{csrf_token()}}'},
                    dataType: 'json',
                    success: function(data){
                        if (data.code == 0){
                            $(obj).parents("tr").remove();
                            layer.msg(data.msg,{icon:1,time:1000});
						}else {
                            layer.msg(data.msg);
						}
                    }
                });
            });
        }
	</script>
@endsection